package com.lg.utils.hutool.util;

import cn.hutool.core.util.RuntimeUtil;

import java.util.List;

public class RuntimeUtilTest {
    public static void main(String[] args) {
        String str = RuntimeUtil.execForStr("ipconfig");
        System.out.println(str);

        System.out.println("==========");

        Process pro = RuntimeUtil.exec("ipconfig");

        System.out.println(pro.isAlive());
        try {
            int i = pro.waitFor();
            System.out.println(i);
            System.out.println(pro.exitValue());
//            result 只能被调用一次
//            System.out.println(RuntimeUtil.getResult(pro));
            System.out.println("=========");
            System.out.println(RuntimeUtil.getErrorResult(pro));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//            result 只能被调用一次
        List<String> resultLines = RuntimeUtil.getResultLines(pro);
        System.out.println(resultLines);
        System.out.println("=========");

    }
}
